#ifndef __MOTOR_H
#define __MOTOR_H


#include "main.h"


//M1->TIM2.CH1(APB1)
//M2->TIM2.CH2(APB1)
//M3->TIM2.CH3(APB1)
//M4->TIM1.CH4(APB2)
//M5->TIM3.CH2(APB1)
//M6->TIM3.CH3(APB1)
//M7->TIM15.CH1(APB2)
//M8->TIM15.CH2(APB2)


#define MIN_SPEED 300
#define MAX_SPEED 1000


extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim15;


#define M1_TIMER htim2
#define M2_TIMER htim2
#define M3_TIMER htim2
#define M4_TIMER htim1
#define M5_TIMER htim3
#define M6_TIMER htim3
#define M7_TIMER htim15
#define M8_TIMER htim15


#define M1_CHANNEL TIM_CHANNEL_1
#define M2_CHANNEL TIM_CHANNEL_2
#define M3_CHANNEL TIM_CHANNEL_3
#define M4_CHANNEL TIM_CHANNEL_4
#define M5_CHANNEL TIM_CHANNEL_2
#define M6_CHANNEL TIM_CHANNEL_3
#define M7_CHANNEL TIM_CHANNEL_1
#define M8_CHANNEL TIM_CHANNEL_2










void motor_init();
void motor_set_speed(uint8_t motor,uint16_t speed);


#endif
